package com.codestudy.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.codestudy.entity.Comment;
import com.codestudy.vo.CommentVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 评论表(Comment)表数据库访问层
 *
 * @author makejava
 * @since 2024-04-13 14:17:51
 */
@Mapper
public interface CommentDao extends BaseMapper<Comment> {

    /**
     * 批量修改点赞数量
     *
     * @param list
     * @return
     */
    int updateBatchById(List<Comment> list);

    int insertComment(Comment comment);

    List<CommentVO> commentVOSelect(CommentVO commentVO);

    Integer commentIdSelect(Integer noteId);

    List<CommentVO> commentSelect(Integer noteId);

    Integer selectByUid(Integer id);

    Integer selectArticle(Integer id);

    @Select("select count(*) from comment where article_id = #{noteId}")
    Integer count(Integer noteId);
}

